const debounce =   (fn:Function,time:number) => {
  let timer:null|number = null
  return () => {
    if (timer) {
      clearTimeout(timer)
      timer = null
    } else {
      timer = window.setTimeout(function() {
        fn.apply(this,arguments)
      },time)
    }
  }
}

export default debounce

export { debounce }